package com.itheima.mapper;

import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmpMapper {
//    /**
//     * 数据数量查询
//     * @return
//     */
//    @Select("select count(*) from emp")
//    Long count();
//
//
//    /**
//     * 分页查询
//     * @param start
//     * @param pageSize
//     * @return
//     */
//    @Select("select * from emp limit #{start}, #{pageSize}")
//    List<Emp> page(Integer start, Integer pageSize);
    List<Emp> list(String name, Short gender, LocalDate begin, LocalDate end);

    void deleteEmps(List<Integer> ids);

    void insertEmp(Emp emp);

    @Select("select * from emp where id = #{id}")
    Emp selectById(Integer id);

    void updateTime(Emp emp);

    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp getByUsernameAndPassword(String username, String password);

    @Delete("delete from emp where dept_id = #{id}")
    void deleteByDeptId(Integer id);
}
